package com.mate.model;

import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.StringUtils;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 电影详情
 * </p>
 *
 * @author boy
 * @since 2020-05-15
 */
@TableName("m_movie")
public class MMovie extends Model<MMovie> {

    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.INPUT)
    private Integer id;
    /**
     * 标题
     */
    private String title;
    /**
     * 英文标题
     */
    @TableField("English_title")
    private String EnglishTitle;
    /**
     * 电影类型
     */
    @TableField("movie_type")
    private String movieType;
    /**
     * 屏幕类型
     */
    @TableField("screen_type")
    private String screenType;
    /**
     * 演员
     */
    @TableField("actor_name")
    private String actorName;
    /**
     * 上映地点
     */
    private String address;
    /**
     * 上映时间
     */
    private String comingTime;
    /**
     * 电影时长
     */
    @TableField("movie_time")
    private String movieTime;
    /**
     * 想看人数
     */
    @TableField("expected_number")
    private Integer expectedNumber;
    /**
     * 简介
     */
    private String info;
    /**
     * {
     * name:'xxx',
     * pic:'xxxx'
     * },演员姓名与照片
     */
    @TableField("actors_name")
    private String actorsName;
    /**
     * 剧照 list
     */
    private String stills;
    @TableField("create_time")
    private Date createTime;
    @TableField("is_delete")
    private String isDelete;
    /**
     * 0 热映  1 待映  2 经典  3 排行
     */
    private String type;
    /**
     * 封面
     */
    @TableField("cover_pic")
    private String coverPic;
    /**
     * 评分
     */
    private String score;
    /**
     * 票房
     */
    @TableField("box_office")
    private String boxOffice;

    @TableField(exist = false)
    private String img = "";

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getEnglishTitle() {
        return EnglishTitle;
    }

    public void setEnglishTitle(String EnglishTitle) {
        this.EnglishTitle = EnglishTitle;
    }

    public String getMovieType() {
        return movieType;
    }

    public void setMovieType(String movieType) {
        this.movieType = movieType;
    }

    public String getScreenType() {
        return screenType;
    }

    public void setScreenType(String screenType) {
        this.screenType = screenType;
    }

    public String getActorName() {
        return actorName;
    }

    public void setActorName(String actorName) {
        this.actorName = actorName;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getComingTime() {
        return comingTime;
    }

    public void setComingTime(String comingTime) {
        this.comingTime = comingTime;
    }

    public String getMovieTime() {
        return movieTime;
    }

    public void setMovieTime(String movieTime) {
        this.movieTime = movieTime;
    }

    public Integer getExpectedNumber() {
        return expectedNumber;
    }

    public void setExpectedNumber(Integer expectedNumber) {
        this.expectedNumber = expectedNumber;
    }

    public String getInfo() {
        return info;
    }

    public void setInfo(String info) {
        this.info = info;
    }

    public String getActorsName() {
        return actorsName;
    }

    public void setActorsName(String actorsName) {
        this.actorsName = actorsName;
    }

    public String getStills() {
        return stills;
    }

    public void setStills(String stills) {
        this.stills = stills;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getIsDelete() {
        return isDelete;
    }

    public void setIsDelete(String isDelete) {
        this.isDelete = isDelete;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getCoverPic() {
        return coverPic;
    }

    public void setCoverPic(String coverPic) {
        this.coverPic = coverPic;
    }

    public String getScore() {
        return score;
    }

    public void setScore(String score) {
        this.score = score;
    }

    public String getBoxOffice() {
        return boxOffice;
    }

    public void setBoxOffice(String boxOffice) {
        this.boxOffice = boxOffice;
    }

    public String getImg() {
        if (StringUtils.isNotBlank(stills)) {
            stills = stills.replace("[", "");
            stills = stills.replace("]", "");
            stills = stills.replace("\"", "");
            img = stills.split(",")[0];
            img = img.replaceAll("w.h", "128.180");
        }
        return img;
    }

    public void setImg(String img) {
        this.img = img;
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

    @Override
    public String toString() {
        return "MMovie{" +
                ", id=" + id +
                ", title=" + title +
                ", EnglishTitle=" + EnglishTitle +
                ", movieType=" + movieType +
                ", screenType=" + screenType +
                ", actorName=" + actorName +
                ", address=" + address +
                ", comingTime=" + comingTime +
                ", movieTime=" + movieTime +
                ", expectedNumber=" + expectedNumber +
                ", info=" + info +
                ", actorsName=" + actorsName +
                ", stills=" + stills +
                ", createTime=" + createTime +
                ", isDelete=" + isDelete +
                ", type=" + type +
                ", coverPic=" + coverPic +
                ", score=" + score +
                ", boxOffice=" + boxOffice +
                "}";
    }
}
